<template>
  <!-- 动态组件 -->
  <component :is="currentView"></component>

</template>

<script setup>
import { ref, watch, shallowRef } from 'vue';
import Index from '@/views/Index.vue';
import Login from '@/views/Login.vue';
import { useRoute } from 'vue-router'; 


const route = useRoute(); 

const currentView = shallowRef(route.name === 'LoginView' ? Login : Index) ;

watch(route, newVal => {
    currentView.value = newVal.name === 'LoginView' ? Login : Index ;
}, {immediate: true})

</script>

<style>
* {
  margin: 0;
  padding: 0;
}
body {
  overflow: hidden;
}
</style>

